// pages/classroom/classroom.js
import {consultantDetail} from '../../api/curriculum.js'
Page({
  data: {
    value:"",
    swiperList:[],
    list:[],
    barShow:false,
    pageNum:1
  },
  /**
   * 生命周期函数--监听页面加载
   */
  async onLoad(options) {
   let r = await consultantDetail(this.data.pageNum,8)
   console.log(r);
    let list =r.data.data.list
    this.setData({
        swiperList:list.splice(0,2),
        list:list
       
    })
  },
  async onReachBottom(){
      console.log("daodila");
      if(this.data.barShow){
          return
      }
      this.data.pageNum++
     this.setData({
         pageNum:this.data.pageNum,
         barShow:true
     })
     let r = await consultantDetail(this.data.pageNum,8)
     this.data.list.push(...r.data.data.list)
      this.setData({
          list:this.data.list,
          barShow:false
      })
  },
  Jump(e){
        wx.navigateTo({
            url: `../../curriculum/pages/curriculum/curriculum?id=${e.currentTarget.dataset.id}`,
            })
  },
  goToTeacher: function() {
    wx.navigateTo({
      url: '../../classroom/pages/teachers/teachers' // 跳转的目标页面路径
    });
  }
})
